#include "RequirementType.h"
#include <QtDebug>

namespace RequirementType
{
	QString NameOf(Type i_type)
    {
        QString name;
        switch (i_type)
        {
        case Priesthood:
            name = "Priesthood";
            break;
        case Family:
            name = "Family";
            break;
        case Quorum:
            name = "Quorum";
            break;
        case Education:
            name = "Education";
            break;
        case Physical:
            name = "Physical";
            break;
        case Spiritual:
            name = "Spiritual";
            break;
        case Citizenship:
            name = "Citizenship";
            break;
        case Service:
            name = "Service";
            break;
        case Journal:
            name = "Journal";
            break;
        }
        return name;
    }
    
    Type ValueOf(QString i_name)
    {
        Type type = Priesthood;
        if (i_name.compare("Priesthood", Qt::CaseInsensitive) == 0)
            type = Priesthood;
        else if (i_name.compare("Family", Qt::CaseInsensitive) == 0)
            type = Family;
        else if (i_name.compare("Quorum", Qt::CaseInsensitive) == 0)
            type = Quorum;
        else if (i_name.compare("Education", Qt::CaseInsensitive) == 0)
            type = Education;
        else if (i_name.compare("Physical", Qt::CaseInsensitive) == 0)
            type = Physical;
        else if (i_name.compare("Spiritual", Qt::CaseInsensitive) == 0)
            type = Spiritual;
        else if (i_name.compare("Citizenship", Qt::CaseInsensitive) == 0)
            type = Citizenship;
        else if (i_name.compare("Service", Qt::CaseInsensitive) == 0)
            type = Service;
        else if (i_name.compare("Journal", Qt::CaseInsensitive) == 0)
            type = Journal;
        else
        	qWarning() << "WARNING: RequirementType::ValueOf() failed to find "
        	           << " value of string " << i_name;
        return type;
    }
    
    Type& operator++(Type& i_type)
    {
		i_type = Type(i_type + 1);
    	return i_type;
    }

    Type operator++(Type& i_type, int)
    {
    	Type rtn = i_type;
    	++i_type;
    	return rtn;
    }

}

